﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#if DOT_NET
using Microsoft.VisualStudio.TestTools.UnitTesting;
#else
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
#endif
using StyleMVVM.DependencyInjection;
using StyleMVVM.UnitTests.TestClasses.GenericObjects;

namespace StyleMVVM.UnitTests.DependencyInjection
{
	[TestClass]
	public class FluentGenericExportTests
	{
		[TestMethod]
		public void RegisterFluentExportTest()
		{
			Bootstrapper bootstrapper = new Bootstrapper();

			bootstrapper.Container.Register(typeof(FluentExportObject<>)).As(typeof(IFluentGenericInterface<>));
			bootstrapper.Container.Register<FluentImportObject>().As<FluentImportObject>().ImportProperty(x => x.GenericInterface);

			bootstrapper.Start();

			FluentImportObject importObject = bootstrapper.Container.Locate<FluentImportObject>();

			Assert.IsNotNull(importObject);
			Assert.IsInstanceOfType(importObject.GenericInterface, typeof(FluentExportObject<int>));

			bootstrapper.Shutdown();
		}
	}
}
